package com.example.demo555.controller;


import com.example.demo555.common.R;
import com.example.demo555.entity.Picture;
import com.example.demo555.service.PictureService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * <p>
 * 图床 前端控制器
 * </p>
 *
 * @author faiz
 * @since 2021-07-14
 */
@Api(value = "图床工具")
@RestController
@RequestMapping("/picture")
public class PictureController {

    private final PictureService pictureService;

    @Autowired
    public PictureController(PictureService pictureService) {
        this.pictureService = pictureService;
    }

    @ApiOperation(value = "获取图片信息")
    @GetMapping(value = "/listPictures")
    public R uploadPicture() {
        List<Picture> pictures = pictureService.listTOpPictures();
        return R.ok().data("items", pictures);
    }
}

